package com.example.leetdemo.plan1;

import java.time.LocalDateTime;

public class Sword018 {

    public boolean isPalindrome(String s) {
        StringBuilder builder = new StringBuilder();
        int p = 'a' - 'A';
        for (int i = 0; i < s.length(); i++) {
            char t = s.charAt(i);
            if (t >= '0' && t <= '9') {
                builder.append(t);
            }
            if (t >= 'a' && t <= 'z') {
                builder.append(t);
            }
            if (t >= 'A' && t <= 'Z') {
                builder.append((char) (t + p));
            }
        }
        if (builder.length() <= 1) {
            return true;
        }
        String a = builder.toString();
        String b = builder.reverse().toString();
        return a.equals(b);
    }

    public static void main(String[] args) {
        System.err.println((float) LocalDateTime.now().getMinute() / 60f);
        System.err.println((char) ('A' - 26));
        Sword018 sword018 = new Sword018();
        System.err.println(sword018.isPalindrome("A man, a plan, a canal: Panama"));
    }
}
